package cn.com.cifi.mars.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import cn.com.cifi.mars.entity.EsbPushLog;
import cn.com.cifi.mars.mapper.mars.EsbPushLogMapper;
import cn.com.cifi.mars.service.EsbPushLogService;

/**
 * <p>
 * ESB推送日志表 服务实现类
 * </p>
 *
 * @author yyd
 * @since 2020-09-22
 */
@Service
public class EsbPushLogServiceImpl extends ServiceImpl<EsbPushLogMapper, EsbPushLog> implements EsbPushLogService {

	@Autowired
	EsbPushLogMapper esbPushLogMapper;
	
	@Override
	public EsbPushLog getByVersionId(String versionId) {
		QueryWrapper<EsbPushLog> logQueryWrapper = new QueryWrapper<EsbPushLog>();
		logQueryWrapper.eq("version_id",versionId);
        EsbPushLog log = esbPushLogMapper.selectOne(logQueryWrapper);
		return log;
	}
	
	@Override
	public EsbPushLog getByProjectId(String projectId) {
		QueryWrapper<EsbPushLog> logQueryWrapper = new QueryWrapper<EsbPushLog>();
		logQueryWrapper.eq("project_id",projectId);
        EsbPushLog log = esbPushLogMapper.selectOne(logQueryWrapper);
		return log;
	}

	@Override
	public void insert(EsbPushLog log) {
		esbPushLogMapper.insert(log);
	}

	@Override
	public void update(EsbPushLog log) {
		esbPushLogMapper.updateById(log);
	}

}
